{extend name="layout:base" /}{block name="content"}
<?php
$global=isSupperManagerForSession();
?>
<style>
.table th{text-align:center;}
.tip{position:absolute;background:#9FC;border-color:#F60;z-index:9999;filter:alpha(opacity=80);-moz-opacity:0.8;-khtml-opacity: 0.8;opacity: 0.8;}
.hidden-detail{display:none;}
.mypointer{width:95%;overflow:hidden;height:25px;line-height:25px;cursor: pointer;}
</style>

<link rel="stylesheet" type="text/css" href="/static/admin/css/style.css" />
<script src="/static/mimi/js/confirm/js/jquery-1.9.1.js"></script>
<link rel="stylesheet" href="/static/mimi/css/animate.min.css" type="text/css" />
<link rel="stylesheet" href="/static/mimi/css/font-awesome.min.css" type="text/css" />
   
<section class="topBanners">
   <div class="icon"></div>
   <div class="topBannersNav">
       <span data-url="/admin/classlist/lists" onclick="ContentLoadGo('/admin/classlist/lists')">挑战管理</span>
       >
   		<span data-url="/admin/classlist/salelists" onclick="ContentLoadGo('/admin/classlist/salelists?class_id=<?php echo $class_id; ?>')">销售管理</span>
   </div>
</section>
   
<section id="serach_section" style="margin-top:10px;margin-left:auto;margin-right:auto;">
姓名：<input type="text" class="textbox" name="ser_username" id="ser_username" value="<?php echo $request['ser_username']; ?>" placeholder=""/>
份数：<input type="text" class="textbox" name="ser_min_num" id="ser_min_num" value="<?php echo $request['ser_min_num']; ?>" placeholder=""/>
    -
    <input type="text" class="textbox" name="ser_max_num" id="ser_max_num" value="<?php echo $request['ser_max_num']; ?>" placeholder=""/>
    <select id="ser_is_win" class="ser_is_win select" name="ser_is_win">
        <option value="">--挑战状态--</option>
        <option value="0" <?php if($request['ser_is_win']=='0'){echo 'selected';} ?> >进行中</option>
        <option value="1" <?php if($request['ser_is_win']=='1'){echo 'selected';} ?> >成功</option>
        <option value="1" <?php if($request['ser_is_win']=='2'){echo 'selected';} ?> >失败</option>
    </select>

    <select id="ser_is_yuer" class="ser_is_yuer select" name="ser_is_yuer">
        <option value="">--奖金是否发放--</option>
        <option value="0" <?php if($request['ser_is_yuer']=='0'){echo 'selected';} ?> >未发放</option>
        <option value="1" <?php if($request['ser_is_yuer']=='1'){echo 'selected';} ?> >已发放</option>
    </select>

      <input type="button" value="搜索" class="group_btn research" id="resource" page="1" />
    
      <br style="clear:both;width:0px;height:0px;">
</section>
 
<table class="table" style="margin-top:10px;">
<tr>
<th style="width:50px;">ID</th>
<th style="width:100px;">时间</th>
<th style="width:50px;">姓名</th>
<th style="width:50px;">份数</th>
<th style="width:50px;">付款金额</th>
<th style="width:50px;">订单号</th>
<th style="width:50px;">挑战状态</th>
<th style="width:50px;">发放奖金</th>
<th style="width:50px;">发放状态</th>
<th style="width:50px;">操作</th>
</tr>
<?php 
foreach($lists['data'] as $key=>$val)
{
?>
<tr data-id="<?php echo $val['id']; ?>" data-uid="<?php echo $val['uid']; ?>">
<td style="text-align:left;"><?php echo $val['id']; ?></td>

<td><?php echo $val['ctime']; ?></td>
<td><?php echo $val['UserInfo']['nickname'];?></td>
<td><?php echo $val['num'];?></td>
<td><?php echo $val['money'];?></td>
<td><?php echo $val['payno'];?></td>
<td><?php
if($val['is_win']==0)
{
echo '进行中';
}else if($val['is_win']==1)
{
echo '成功';
}
else if($val['is_win']==2)
{
echo '失败';
}
?></td>
    <td>
       <?php
        if($val['is_win']==1 && $classinfo['is_open_reward']==1)
        {
      ?>
        <?php echo ($val['reward_money']+$val['per_win_money'])*$val['num']; ?>
        <?php
}
        ?>
    </td>
    <td><?php
if($val['is_yuer']==0)
{
echo '未发放';
}else if($val['is_yuer']==1)
{
echo '已发放';
}
else if($val['is_yuer']==2)
{
echo '等待发放';
}

?></td>
    <td>
        <?php
            if($classinfo['is_open_reward']==1)
            {
                if($val['is_win']==1 && $val['is_yuer']!=1)
                {
                    $tempTime = time();
                    if(empty($val['next_send_money_time']) || $val['next_send_money_time']<$tempTime)
                    {
            ?>
                     <input type="button" power="22003" value="发放金额" style="margin-right:10px;width:80px;" class="group_btn sendMoney" />
            <?php
                    }
                }else
                {
                ?>
        <input type="button" power="22003" value="查看明细" onclick="javascript:document.location.href='/admin/user/moneyDetail?pid=<?php echo $val[uid]; ?>'" style="margin-right:10px;width:80px;" class="group_btn moneyDetail" />

                <?php
                }
            }
        ?>


        <?php
if( ( in_array(30100,$ruleLists) || $global==1) )
{
?>
        <input type="button" power="30100" value="打卡记录" class="link_btn checkinList"/>
        <?php
}
?>
    </td>
</tr>

<?php
}
?>
</table>
{include file="../application/admin/view/layout/page_tpl_new.html" /}
<script type="text/javascript">
function myResearch(){
    var url="/admin/classlist/salelists";
    var generaData=$("#serach_section [name^='ser_']");
    var page=$("#cpage").val();
    var class_id = "<?php  echo $class_id; ?>";
    var param={
        page:page,
        'class_id':class_id
    };
    getSearchFormData(generaData,param);
    ContentLoadGo(url,param);
}

$(function(){
 //设置搜索栏
 $(".research").unbind().bind("click",function(){
    var page =$(this).attr("page");
    $("#cpage").val(page);
    myResearch();
 });

//编辑
$(".del").unbind().bind("click",function(){
   var that =this;
   var url="/admin/classlist/saleDataDel";
   var id=$(that).parent().parent().attr('data-id');
    var class_id = "<?php  echo $class_id; ?>";
   var param={
           id:id,
           class_id:class_id
   };
   ContentLoadGo(url,param);
});


    //上架
    $(".sendMoney").unbind().bind("click",function(){
        var that =this;
        var url="/admin/classlist/sendMoney";
        var id=$(that).parent().parent().attr('data-id');
        var class_id = "<?php  echo $class_id; ?>";
        var param={
            id:id,
            class_id:class_id
        };
        cofirmsss_tishi(1,'您确定要执行该操作吗？',function(id){

            AjaxRequest(url,param,function(data){
                if(data.err==0)
                {
                    SuccessTiShi(data.msg);
                    setTimeout(function(){
                        myResearch();
                    },3000)

                }
                else
                {
                    ErrTiShi(data.msg);
                }
            });

        });
    });

//详情
$(".info").unbind().bind("click",function(){
   var that =this;
   var url="/admin/music/infoData";
   var id=$(that).parent().parent().attr('data-id');
   var param={
           id:id
   };
   ContentLoadGo(url,param);

});
        	   
//导航
$(".topBannerItem").unbind().bind("click",function(){
   var attArr = $(this).attr();
   goToSelfLink(attArr);

});

//详情
    $(".checkinList").unbind().bind("click",function(){
        var that =this;
        var url="/admin/classlist/checkinList";
        var class_id = "<?php  echo $class_id; ?>";
        var id=$(that).parent().parent().attr('data-id');
        var uid=$(that).parent().parent().attr('data-uid');
        var param={
            class_id:class_id,
            uid:uid
        };
        ContentLoadGo(url,param);

    });

        	   
//全选
$("#all").unbind().bind("click",function(){
    if(this.checked){
        $(".checkBoxInput").attr("checked", true);
        $(".checkBoxInput").prop("checked", true);
    }else{
        $(".checkBoxInput").attr("checked", false);
        $(".checkBoxInput").prop("checked", false);
    }
    var se=getAllSelectItem();
});

});
</script>
<script>
$(function (){
    $("[data-toggle='tooltip']").tooltip();
});
</script>
{/block}
   